package com.thb.pay.manage.web.merchant;


import com.thb.pay.api.merchant.MchBillServiceApi;
import com.thb.pay.api.merchant.vo.req.MchBillPageReq;
import com.thb.pay.api.merchant.vo.req.MchBillReq;
import com.thb.pay.api.merchant.vo.resp.MchBillVo;
import com.thb.pay.core.utils.PageResult;
import com.thb.pay.core.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商户-对账单 前端控制器
 * </p>
 *
 * @author lucky
 * @since 2019-07-21
 */
@RestController
@RequestMapping("/api/sys/mchBill")
public class MchBillController {
    @Autowired
    private MchBillServiceApi mchBillServiceApi;

    @PostMapping("/list")
    public R list(@RequestBody MchBillPageReq pageReq) {
        PageResult<MchBillVo> pageResult = mchBillServiceApi.findPage(pageReq);
        return R.okData(pageResult);
    }

    @RequestMapping("/get")
    public R get(@RequestParam("id") Long id) {
        MchBillVo resultData = mchBillServiceApi.getById(id);
        return R.okData(resultData);
    }

    @PostMapping("/add")
    public R add(@RequestBody MchBillReq mchBillReq) {
        mchBillServiceApi.add(mchBillReq);
        return R.ok();
    }

    @PostMapping("/update")
    public R update(@RequestBody MchBillReq mchBillReq) {
        mchBillServiceApi.update(mchBillReq);
        return R.ok();
    }
}
